package business.model.tableModel;

import java.util.Arrays;
import java.util.List;

import javax.swing.table.AbstractTableModel;

import business.model.ClienteTO;

public class ClienteTableModel extends AbstractTableModel {

	public List<ClienteTO> cliente;
	public List<String> colunas;

	public ClienteTableModel(List<ClienteTO> clienteTO) {
		this.cliente = clienteTO;

		this.colunas = Arrays.asList("Nome", "Telefone", "Endereco", "CEP");
	}

	@Override
	public int getRowCount() {
		return this.cliente.size();
	}

	@Override
	public int getColumnCount() {
		return this.colunas.size();
	}

	@Override
	public String getColumnName(int column) {
		return this.colunas.get(column); // To change body of generated methods,
											// choose Tools | Templates.
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		ClienteTO cliente = this.cliente.get(rowIndex);
		switch (columnIndex) {
		// case 0: return agenda.getCodigo();
		case 0:
			return cliente.getNome();
		case 1:
			return cliente.getTelefone();
		case 2:
			return cliente.getEndereco();
		case 3:
			return cliente.getCep();

		}
		return null;
	}

}
